import request from '@/utils/request'
export default {
  listAll(data) {
    return request({
      url: `/admin/core/adminRole/list`,
      method: 'get',
      params: data
    })
  },

  saveOrUpdate(data) {
    return request({
      url: '/admin/core/adminRole/saveOrUpdate',
      method: 'post',
      data: data
    })
  },

  listById(id) {
    return request({
      url: `/admin/core/adminRole/info/${id}`,
      method: 'get'
    })
  },

  removeById(id) {
    return request({
        url: `/admin/core/adminRole/remove/${id}`,
        method: 'post'
    })
  },

  // 查询所有菜单
  listMenus() {
    return request({
      url: `/admin/core/adminRoleMenu/listMenus`,
      method: 'get'
    })
  },

  // 保存或修改角色与菜单
  saveOrUpdateMenus(data) {
    return request({
      url: '/admin/core/adminRoleMenu/saveOrUpdate',
      method: 'post',
      data: data
    })
  },

  // 通过角色查询所属菜单
  listByRoleId(roleId) {
    return request({
      url: `/admin/core/adminRoleMenu/getByRoleId/${roleId}`,
      method: 'get'
    })
  },
}